<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="https://code.jquery.com/jquery-3.3.1.min.js" crossorigin="anonymous"></script>
    <title>Ajax</title>
</head>
<body>
    <input type="button" value="发送" onclick="send()">
    <script>
        function send(){
            $.post(
                // url
                "/community/alpha/ajax",
                // json格式参数
                {"name":"张三","age":23},
                // 匿名回调函数(data是浏览器返回的数据)
                function (data){
                    console.log(typeof(data));
                    console.log(data);
                    // $.parseJSON
                    data = $.parseJSON(data);
                    console.log(data.code);
                    console.log(data.msg);
                }
            )
        }
    </script>
</body>
</html>